Skip to content

fix(engine): a render keeps a fixed amount of the page's warning text and script addresses - #8821

Merged
miguel-heygen merged 7 commits into
mainfrom
fix/capture-session-text-ceiling
Nov 25, 2026
Merged

miguel-heygen merged 7 commits into
mainfrom
fix/capture-session-text-ceiling

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

A render now keeps a fixed amount of the page's text in its warnings and in its record of served scripts. Each warning's message, and each list in its details (media sources, timeline ids still unregistered, isolated elements), is cut to the same bounds #8727 set for page errors: 2,000 characters per entry, 50 entries per list. All warnings together stop at 1,000,000 characters of text; past that, a warning is still kept once per kind, with its lists emptied, so a render's policy still sees every kind of warning. The set of served script URLs used to tell whether an error came from the project keeps at most 500 URLs of up to 2,000 characters.

Why

#8727 and #8810 bounded page errors, failed scripts, the console buffer and throw-site lookups. Three places still kept page-chosen text without a limit: warnings (each one listed every source or timeline id the page named, at full length, and every distinct warning was kept), and the served-script set (one entry per script URL the page fetched from the server). A page that names many long sources, or fetches scripts under ever-new URLs, grew the render's memory without end.

How

In packages/engine/src/services/frameCapture.ts:

  • boundedWarning cuts a warning's message with boundedPageText and every array in its details to PAGE_LIST_MAX entries, cutting each string (and each string field of an object entry). It is applied in recordCaptureWarnings, the one place every capture warning goes through before session.warnings.
  • warningToKeep charges each new warning's text to session.warningTextChars. Past WARNINGS_TEXT_MAX_CHARS a warning is kept only if no warning of its code is kept yet, with its lists emptied.
  • The response listener adds a served script URL only while the set holds fewer than SERVED_SCRIPTS_MAX and the URL is at most PAGE_TEXT_MAX_CHARS. A throw from a script past those limits is not attributed to the project.

Page errors, failed scripts and scene-callback errors are not charged to the warnings total: they are already capped by count and length, and charging them would let a flood of warnings drop a real script error before the render fails on it. With every list capped, a render keeps at most about 2.7M characters of page text in all: the console buffer (200 × 2,000), page errors, failed scripts and scene-callback errors (50 × 2,000 each), warnings (1,000,000, plus one emptied warning per kind), and served scripts (500 × 2,000).

Left as is: lateImages keeps each late image's full source, because it is matched against the frame's images to fail a frame that would miss one; cutting or capping it would let a missing image through.

Reused: boundedPageText, PAGE_TEXT_MAX_CHARS and PAGE_LIST_MAX from #8727; no new helper outside this file.

Test plan

  • Unit tests added in packages/engine/src/services/frameCapture.test.ts:
    • "keeps a warning's timeline ids and media sources only up to a fixed count and size": a timeline warning with 1,000 ids of 10,000 characters and a media warning with 1,000 such sources. Every message and list entry is at most 2,000 characters and every list at most 50 entries.
    • "keeps a fixed total of page text per render, and still each kind of warning": 2,000 distinct media warnings, then a timeline warning. All warnings together stay under 1.1M characters and both kinds are kept.
    • "remembers a fixed number of served script addresses", through the real listeners: 2,000 served scripts, then a throw from the first and from the last. Only the first is attributed.
  • On the devbox: the whole engine suite, 3,752 tests, passes; the three test files touching warnings pass 3 runs in a row; typecheck, lint, format and the commit hooks are green. Packed engine is 519,795 bytes against its 522,000 budget.
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

fails without the fix: all three new tests fail on main d15883f (a kept entry of 10,006,264 characters; 4,177,396 characters of warnings; the 2,000th served script still attributed). With the warnings total raised out of reach, the total test fails again with 4,177,396.

… and script addresses

A warning's message and each of its lists are cut to the page-text bounds. Warnings stop at a
fixed total of text; past it, one per code is kept with its lists emptied. The served-script set
is capped by count and URL length.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — Keep render failure detection when the script URL budget fills. packages/engine/src/services/frameCapture.ts:3244 drops attribution for otherwise valid composition script URLs once the set is full or a URL exceeds the length cap. The exception listener then returns before updating pageErrors (:3276). When the expected timeline never registers, isScriptFailure at :2118 can treat that render as an ordinary readiness timeout. The producer can continue in its permissive mode and deliver a render missing animation. Keep the URL cache bounded and preserve the failure signal for an expected timeline that times out after an attributable project script exception. The served-script test currently expects that exception to disappear.

The fails without the fix: line should name the regression tests or frameCapture.test.ts directly so the cases can be located from the line.

— tai (automated review)

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — Apply the warning budget to the whole render. The counter at packages/engine/src/services/frameCapture.ts:2606 resets with each capture session. The segmented stage saves each recycled session's warning summary (packages/producer/src/services/render/stages/captureSegmentedStage.ts:522), then the orchestrator combines all those warnings (packages/producer/src/services/renderOrchestrator.ts:5911). The retained warnings can therefore grow with the session count. Apply the aggregate budget as these summaries are retained, and keep the per-kind fallback for policy.

The warning copy also leaves the full diagnostic-only isolatedCompositions list on the capture session (packages/engine/src/services/frameCapture.ts:2178). Bound the retained list at that assignment while preserving the isolation work performed in the page.

— tai (automated review)

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 64 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

Unstable (1)

  • seqplainkeys-none-px-r0-root-z100: tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

… its capture sessions

A summary joins the render's list through retainCapturePerf, which bounds its warnings by what the
list already keeps. Past the served-script cap, a script on the composition's server still counts,
so its throw still marks the script failure. The isolated-composition record is cut to the bounds.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Both reviews are addressed at 30537d4. The body stays as opened (legal hold), so the corrections are here.

Served-script cap and timeline failure detection. Past SERVED_SCRIPTS_MAX, or for a URL over PAGE_TEXT_MAX_CHARS, the response listener now sets servedPrefix to the composition server's URL instead of dropping the script, and classifyPageError and describeThrowSite count any URL under it as served. A throw from such a script is recorded in pageErrors, so isScriptFailure still sees it when the expected timeline never registers. The set itself stays at 500 URLs. The test now expects the throw: "still records a throw from a served script past the served-script cap or with a long URL".

Warning budget for the whole render. The new engine export retainCapturePerf(list, summary) adds a capture session's summary to the render's list with its warnings bounded by what the list already keeps (same 1,000,000-character total, same one-per-kind fallback with lists emptied). Every place a summary was pushed uses it: captureStage, captureSegmentedStage at a recycle and at the end, captureStreamingStage, and pushWorkerDedupPerfs. The budget is built from the list itself, so a retry that empties the list starts with a full budget. Repeated code-and-details keys are dropped as they are retained, which applyRenderWarningPolicy already did when combining them. The kept keys also replace the per-warning JSON comparison against every kept warning, which had made the 2,000-warning test time out in the flake gate.

isolatedCompositions. isolateUnregisteredCompositions cuts the list it returns to 50 entries and each id to 2,000 characters, after the page has given every broken composition its empty timeline.

fails without the fix: in packages/engine/src/services/frameCapture.test.ts, "keeps a warning's timeline ids and media sources only up to a fixed count and size" and "keeps a fixed total of page text per render, and still each kind of warning" fail on main d15883f; "still records a throw from a served script past the served-script cap or with a long URL" and "keeps a fixed total of warning text across a render's sessions, and each kind once more" fail at 50501bc; in packages/engine/src/services/frameCapture-subTimelineMemo.test.ts, "isolates every broken composition in the page but keeps a fixed record of them" fails at 50501bc (1,000 records kept). With retainCapturePerf adding summaries unbounded, the render test fails with 8,429,981 characters.

Checked on the devbox: engine suite 3,754 tests pass, producer vitest lane 1,628 pass, the two changed test files pass 10 runs in a row, engine and producer typecheck, lint and format are green, packed engine 520,147 bytes (budget 522,000).

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new path caps warning summaries across recycled sessions and preserves script failure attribution past the tracking cap. Two items still block approval.

  • packages/engine/src/services/frameCapture.ts:2152 bounds isolation diagnostics after page.evaluate returns. The full array still crosses CDP and is decoded in the render process before the slice. Bound the diagnostic count and string lengths inside the page callback while continuing to isolate every broken composition. The current test checks the retained session list, so it misses the size of the callback result.
  • The fails without the fix: line still refers to “all three new tests,” and the test plan describes a script-cap test that this revision replaced. Name the current regression tests or their files directly on that line and update the expected result in the test plan.

Static review and git diff --check passed. I did not rerun the suites.

— tai (automated review)

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two more findings from tracing the new fallback and budget through their callers.

  • [P2] packages/engine/src/services/frameCapture.ts:3193 treats the render document URL as a served script once the fallback activates. An inline-handler exception can then turn a readiness timeout into a fatal script failure. Preserve the existing document exclusion after either limit triggers the fallback.
  • [P2] packages/engine/src/services/parallelCoordinator.ts:1054 still returns each worker's full warning summary. The coordinator collects all results before perfSummary.ts:54 applies the shared budget, so peak retention still scales with the worker count. Apply the shared budget as worker summaries are collected.

— tai (automated review)

… are bounded as they finish

The isolation script records at most 50 compositions with ids cut to 2,000 characters, while
still isolating every broken one. The served-script fallback keeps excluding the documents the
server served. Each parallel worker's summary is bounded against the others as it finishes. Page
text bounds and the warning budget move to pageTextBounds.ts.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

All four findings on 30537d4 are addressed at 5c807e3. This PR's title and body are frozen under the legal hold, so the current test plan and fails without the fix: line are here and replace the ones in the body.

Isolation record crosses CDP at full size. The isolation script in isolateUnregisteredCompositions still gives every broken composition its empty timeline, but records at most PAGE_LIST_MAX (50) of them, each id cut to PAGE_TEXT_MAX_CHARS (2,000) inside the page. Node keeps its own cut too, since a page can patch the built-ins the script uses. The test now checks the callback's return value, not just the session's list.

Document errors after the fallback. The response listener also records the documents the composition server served (up to 50, URLs up to 2,000 characters). isOwnedScriptUrl keeps excluding them after the served-script fallback switches on, so an inline handler's exception on the render document stays a readiness timeout.

Parallel workers' summaries. executeParallelCapture passes each worker's summary through retainCapturePerf against the summaries already collected as that worker finishes, so the held summaries stay within the 1,000,000-character total whatever the worker count. Page-text bounds and the warning budget move to packages/engine/src/services/pageTextBounds.ts, so tests that mock frameCapture.js still run the real budget.

Test plan (current)

  • packages/engine/src/services/frameCapture.test.ts:
    • "keeps a warning's timeline ids and media sources only up to a fixed count and size"
    • "keeps a fixed total of page text per render, and still each kind of warning"
    • "keeps a fixed total of warning text across a render's sessions, and each kind once more"
    • "past the served-script cap, still records a served script's throw and not the document's"
  • packages/engine/src/services/frameCapture-subTimelineMemo.test.ts: "isolates every broken composition in the page but keeps a fixed record of them" (checks the page callback's return: 50 records, ids at most 2,000 characters; all 1,000 compositions get a timeline).
  • packages/engine/src/services/parallelCoordinator-warningBudget.test.ts: "keeps a fixed total of warning text across the workers' summaries" (6 workers of 300 warnings each).
  • On the devbox: engine suite 3,755 tests pass, producer vitest lane 1,628 pass, the three changed test files pass 10 runs in a row, engine and producer typecheck, lint, format and commit hooks green, packed engine 520,895 bytes (budget 522,000).

fails without the fix: in frameCapture.test.ts, "keeps a warning's timeline ids and media sources only up to a fixed count and size" and "keeps a fixed total of page text per render, and still each kind of warning" fail on main d15883f; "keeps a fixed total of warning text across a render's sessions, and each kind once more" fails at 50501bc, and with retainCapturePerf adding summaries unbounded it fails with 8,429,981 characters; "past the served-script cap, still records a served script's throw and not the document's" fails at 50501bc (the late throws dropped) and, with the document exclusion removed, records the document's throw too. In frameCapture-subTimelineMemo.test.ts, "isolates every broken composition in the page but keeps a fixed record of them" fails at 30537d4 (the callback returned 1,000 records). In parallelCoordinator-warningBudget.test.ts, "keeps a fixed total of warning text across the workers' summaries" fails with 3,611,281 characters when worker summaries are not bounded as they finish.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested at 5c807e39.

  • P2 packages/engine/src/services/frameCapture.ts:3216–3231 — The fallback still attributes document exceptions to project scripts when the document URL exceeds 2,000 characters or the document arrives after the first 50. Once the script fallback is active, an exception attributed to an untracked document can make a timeline readiness timeout count as a script failure. Please keep document exclusion correct when the diagnostic cache reaches its limits, and cover that boundary in the listener test.
  • The Comments check is red. It flags the added comment at packages/engine/src/services/parallelCoordinator.ts:1322 for increasing that file’s comment share.

The page callback now bounds the isolated-composition record before returning it, and parallel workers bound retained warning summaries as they finish. The author’s updated test plan names the current regressions. I reviewed the delta statically.

— tai (automated review)

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two details from the additional static pass at 5c807e39.

  • packages/engine/src/services/frameCapture.ts:3133 — The existing document exclusion also misses handler errors after a same-document URL change. The new listener test uses the exact document response URL. Please carry the existing same-document navigation case into the fallback coverage.
  • packages/engine/src/services/frameCapture.ts:2767 — The new message cap can remove the exception and repair text from the warning because pending composition IDs come first. Keep the exception and repair guidance in the bounded message and leave the IDs in the structured details.

— tai (automated review)

…ngs keep their advice

Past the served-script cap, a URL counts as served unless a frame shows it now, so a long, late or
moved document is still excluded with nothing cached. Messages name at most three items of a list,
so the exception and repair advice survive the cut; details keep the lists.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Round 4 on 5c807e3 is addressed at 2bfcb81.

Document or script, from a source that cannot overflow. The document cache is gone. Past the served-script cap, a URL on the composition server counts as served unless one of the page's frames shows it now (page.frames(), compared without the fragment). A long document URL, a document past any count, and a document whose URL a same-document navigation changed are all excluded, and nothing is cached for it.

Exception and repair advice stay in the capped warning. listedInMessage (packages/engine/src/services/pageTextBounds.ts) names at most three items of a list, each cut to 200 characters, with "and N more". The timeline warnings use it for pending ids, isolated compositions and sources, and so does ImageMissingFromFrameError for its image sources. The details keep the lists (50 entries, 2,000 characters each).

Comments check. The added comment in parallelCoordinator.ts is removed. scripts/comment-ratchet.mjs and scripts/check-comment-citations.mjs pass locally against main.

New and changed tests in packages/engine/src/services/frameCapture.test.ts:

  • "past the served-script cap, records a served script's throw and not one from the document at %s", for the document, the document with a fragment, a same-document move to another path, and a 3,000-character document URL. All four fail at 5c807e3; with the frame check removed, all four record the document's throw.
  • "keeps the exception and its repair advice in a timeline warning whose pending ids are long": 1,000 pending ids of 2,000 characters. Fails at 5c807e3.

fails without the fix (all current regression tests): in frameCapture.test.ts, "keeps a warning's timeline ids and media sources only up to a fixed count and size" and "keeps a fixed total of page text per render, and still each kind of warning" fail on main d15883f; "keeps a fixed total of warning text across a render's sessions, and each kind once more" fails at 50501bc; the four "past the served-script cap, records a served script's throw and not one from the document at %s" cases and "keeps the exception and its repair advice in a timeline warning whose pending ids are long" fail at 5c807e3. In frameCapture-subTimelineMemo.test.ts, "isolates every broken composition in the page but keeps a fixed record of them" fails at 30537d4. In parallelCoordinator-warningBudget.test.ts, "keeps a fixed total of warning text across the workers' summaries" fails with 3,611,281 characters when worker summaries are not bounded as they finish.

Checked on the devbox: engine suite 3,759 tests pass, producer typecheck and vitest lane pass, the three changed test files pass 10 runs in a row.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested at 2bfcb813.

  • P2 packages/engine/src/services/frameCapture.ts:3221 — The fallback excludes an exception URL if it matches the current document in any frame. A script outside the exact tracking limits can lose its exception when another frame displays that same URL as a document. That can leave a missing timeline classified as a readiness timeout. Scope document exclusion to the exception's originating context and add a cross-frame regression.
  • The current test plan is in the author comment. The PR body's fails without the fix: line still refers to three tests without naming one and describes the earlier script-attribution result. The review requirement calls for a named regression on that line in the body.

The live frame lookup addresses stale document URLs in the single-frame cases, and the shorter diagnostic lists preserve space for repair guidance. Reviewed statically.

— tai (automated review)

…, with no cap or fallback

The served-script set keeps a sha1 digest of every script URL the composition server answered, so
attribution is exactly main's: a script's throw always counts, a document's never does.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Round 5 on 2bfcb81 is addressed at e2d3784.

Script or document, exactly as on main. The capped served-script set and its fallback are gone. initializeSession keeps a sha1 digest of every script URL the composition server answered with a success, and classifyPageError and describeThrowSite look a URL up by its digest. A script's throw always counts, however many scripts the page loaded and however long their URLs; a document's never does, whatever frame shows it or how it moved; and a script whose URL a frame also shows as a document still counts.

On the round-1 point that the cache stay bounded: each entry is a fixed 28-character digest, whatever the URL's length, so a long URL costs no more than a short one. Entries are added only from the response listener for a successful script answer from the composition's own server, so the set grows by one per distinct script the page actually fetched from that server, each a real request the server answered. It holds no page text.

Page-side isolation cap. Node keeps its own cut after the page's, since a page can patch the built-ins the isolation script uses.

Test, in packages/engine/src/services/frameCapture.test.ts: "records every served script's throw, however many and long, and none from the document at %s" (2,000 served scripts and a 3,000-character one; documents at index.html, index.html#c, a same-document move and a 3,000-character URL; the 2,000th script's throw while a frame shows its URL). All four cases fail at 2bfcb81, where that last throw was dropped.

fails without the fix (all current regression tests, per the frozen body): in frameCapture.test.ts, "keeps a warning's timeline ids and media sources only up to a fixed count and size" and "keeps a fixed total of page text per render, and still each kind of warning" fail on main d15883f; "keeps a fixed total of warning text across a render's sessions, and each kind once more" fails at 50501bc; "keeps the exception and its repair advice in a timeline warning whose pending ids are long" fails at 5c807e3; the four "records every served script's throw, however many and long, and none from the document at %s" cases fail at 2bfcb81. In frameCapture-subTimelineMemo.test.ts, "isolates every broken composition in the page but keeps a fixed record of them" fails at 30537d4. In parallelCoordinator-warningBudget.test.ts, "keeps a fixed total of warning text across the workers' summaries" fails with 3,611,281 characters when worker summaries are not bounded as they finish.

Checked on the devbox: engine suite 3,759 tests pass, the three changed test files pass 10 runs in a row, typecheck, lint and the comment ratchet pass, packed engine 520,922 bytes.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Bound the pending timeline diagnostics before retaining them (packages/engine/src/services/frameCapture.ts:2176)

The warning limit applies to the emitted copy. The capture session still retains the full pending-ID list, and a clean timeout retains it in the shared memo at line 2192. Keep a bounded diagnostic sample and skip memoization when the complete list exceeds its budget, so a partial list cannot change timeline polling. The long-ID regression currently exercises the emitted warning only.

Digest lookup resolves the script-versus-document attribution problem from the previous review. It fixes the retained size per URL and still grows with the number of distinct served scripts. The author comment names the current regression tests. The PR body's fails without the fix: line still refers to the earlier test set without naming a current test.

Static review only on this revision.

— tai (automated review)

…ds, each cut short

The id scan returns at most 1,000 ids of up to 200 characters, so the session and the render's
memo keep a bounded list; a cut id only means that host is waited on again. The script-failure
log names a few failures.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Round 6 on e2d3784 is addressed at 68aaf33.

Pending timeline ids are bounded where they come from. Every pending id comes from listUnregisteredTimelineIds, so it is the one place they are bounded: the page script returns at most TIMELINE_IDS_MAX (1,000) ids, each cut to TIMELINE_ID_MAX_CHARS (200), and Node applies the same bound to whatever comes back. A cut id is still returned, so a pending host always keeps the list non-empty and the wait is never mistaken for ready. The session's pendingTimelineIds and, after a clean timeout, the render's subTimelineWaitMemo.unregisteredIds take that bounded list. Matching in later sessions stays exact for ids that fit; a host whose id was cut, or past the first 1,000, is waited on again rather than skipped, which costs time on such a page, never a wrong answer. The script-failure log line in pollSubCompositionTimelines names its failures through listedInMessage.

Body. Home grants the exception in its re-review post: OSS PR bodies are frozen under the legal hold, and these author comments are the record.

New test, in packages/engine/src/services/frameCapture-subTimelineMemo.test.ts: "sends, keeps and remembers a fixed number of unregistered ids, each cut short" (5,000 hosts with 500-character ids and no timelines; the page's answer, the session's list and the memo each hold 1,000 ids of at most 200 characters). It fails at e2d3784 with 5,000.

fails without the fix (all current regression tests): in frameCapture.test.ts, "keeps a warning's timeline ids and media sources only up to a fixed count and size" and "keeps a fixed total of page text per render, and still each kind of warning" fail on main d15883f; "keeps a fixed total of warning text across a render's sessions, and each kind once more" fails at 50501bc; "keeps the exception and its repair advice in a timeline warning whose pending ids are long" fails at 5c807e3; the four "records every served script's throw, however many and long, and none from the document at %s" cases fail at 2bfcb81. In frameCapture-subTimelineMemo.test.ts, "isolates every broken composition in the page but keeps a fixed record of them" fails at 30537d4 and "sends, keeps and remembers a fixed number of unregistered ids, each cut short" fails at e2d3784. In parallelCoordinator-warningBudget.test.ts, "keeps a fixed total of warning text across the workers' summaries" fails with 3,611,281 characters when worker summaries are not bounded as they finish.

Checked on the devbox: engine suite 3,760 tests pass; the changed test files, with frameCapture-subTimelineTerminal.test.ts, pass 10 runs in a row; typecheck, lint, the commit hooks and the comment ratchet pass.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] A shortened diagnostic ID can change which timeline is waited on (packages/engine/src/services/frameCapture.ts:2200)

The new size bounds cover the page response and session. After a clean timeout, the code also copies the shortened IDs to the memo used for exact matching in later sessions. A shortened label can equal a different host's actual ID. The next poll can then skip that host before its timeline registers. Keep the shortened labels for diagnostics and memoize only exact, unmodified IDs within the budget, or omit the memo when the list is shortened. The regression checks the list's size but does not check this identity distinction.

The author comment names the current regressions. This was a static review.

— tai (automated review)

The page sends null for an id over 200 characters instead of a cut copy, Node shows it as a fixed
label, and the render's memo keeps only exact ids, so no shortened id can match another host and
skip its wait.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Round 7 on 68aaf33 is addressed at a1bb6dc.

Display labels kept apart from the memo. The id scan in listUnregisteredTimelineIds now sends null for an id over TIMELINE_ID_MAX_CHARS (200) instead of a cut copy, still at most 1,000 entries. Node turns each one into the fixed label LONG_TIMELINE_ID for the warning and the session's pendingTimelineIds, so a pending host still keeps the list non-empty. After a clean timeout the render's memo takes only the exact ids, without that label, so a later session skips a host only when its whole id timed out before. A long id is never remembered and is waited on again. A host whose real id happens to equal the label is also waited on again, never skipped.

Tests in packages/engine/src/services/frameCapture-subTimelineMemo.test.ts:

  • "sends, keeps and remembers a fixed number of unregistered ids, remembering only whole ones" (5,000 hosts, half with 500-character ids): the page's answer and the session's list hold 1,000 entries of at most 200 characters, and the memo holds the 500 short ids, each an exact host id. Fails at e2d3784 and at 68aaf33.
  • "waits again for a host whose id equals another host's cut-short id": a 300-character id times out in the first session; in the second it has registered and a host whose id is that id's old cut label is pending. The second session must keep waiting. It fails at 68aaf33, where that host was skipped and the wait ended at once.

fails without the fix (all current regression tests): in frameCapture.test.ts, "keeps a warning's timeline ids and media sources only up to a fixed count and size" and "keeps a fixed total of page text per render, and still each kind of warning" fail on main d15883f; "keeps a fixed total of warning text across a render's sessions, and each kind once more" fails at 50501bc; "keeps the exception and its repair advice in a timeline warning whose pending ids are long" fails at 5c807e3; the four "records every served script's throw, however many and long, and none from the document at %s" cases fail at 2bfcb81. In frameCapture-subTimelineMemo.test.ts, "isolates every broken composition in the page but keeps a fixed record of them" fails at 30537d4, "sends, keeps and remembers a fixed number of unregistered ids, remembering only whole ones" fails at e2d3784, and "waits again for a host whose id equals another host's cut-short id" fails at 68aaf33. In parallelCoordinator-warningBudget.test.ts, "keeps a fixed total of warning text across the workers' summaries" fails with 3,611,281 characters when worker summaries are not bounded as they finish.

Checked on the devbox: engine suite 3,761 tests pass; the timeline memo, terminal and frame-capture test files pass 10 runs in a row; typecheck, lint, the commit hooks and the comment ratchet pass.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed a1bb6dcb. Overlength timeline IDs still count as pending. Their display label is excluded from the memo, so only exact IDs can suppress a later readiness wait. The author comment names the collision regression and the bounds regression.

This was a static review. The comments check passed and the runtime suite was still running when I reviewed.

— tai (automated review)

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit e54c435 Nov 25, 2026
99 checks passed
@miguel-heygen
miguel-heygen deleted the fix/capture-session-text-ceiling branch November 25, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants